{% import "admin-v2/macro.html.twig" as admin_macro %}
{% import "common/data-dict-macro.html.twig" as dict_macro %}

<table class="table table-striped table-hover" id="course-table">
	<thead>
		<tr>
			<td class='text-center'>
				<input class="batch-select" type="checkbox">
			</td>
			<th>{{'admin.course_manage.chooser.num'|trans}}</th>
			<th width="30%">{{'admin.course_manage.chooser.name'|trans}}</th>

			<th>{{'admin.course_manage.chooser.student_num'|trans}}</th>
			<th>{{'admin.course_manage.chooser.status'|trans}}</th>
			<th>{{'admin.course_manage.chooser.creator'|trans}}</th>
		</tr>
	</thead>
	<tbody>
		{% for courseSet in targets %}
			{% set user = users[courseSet.creator]|default(null) %}
			{% set category = categories[courseSet.categoryId]|default(null) %}
			<tr id="course-tr-{{ courseSet.id }}">
				<td class='text-center' data-id="{{courseSet.id}}">
					<input class="batch-item" type="checkbox" value="{{courseSet.id}}" id="batch-item-{{ courseSet.id|default() }}">
				</td>
				<td>{{ courseSet.id }}</td>
				<td>
					<a href="{{ path('course_show',{id: courseSet.defaultCourseId}) }}" target="_blank">
						<strong>{{ courseSet.title|raw }}</strong>
					</a>
					<br>
				</td>
				<td>{{ courseSet.studentNum }}</td>
				<td>{{ dict_macro.courseStatus(courseSet.status) }}</td>
				<td>
					{{ admin_macro.user_link(user) }}
					<br>
					<span class="text-muted text-sm">{{ courseSet.createdTime|date('Y-n-d H:i') }}</span>
				</td>
			</tr>
		{% else %}
			<tr>
				<td colspan="20">
					<div class="empty">{{'admin.course_manage.chooser.empty'|trans}}</div>
				</td>
			</tr>
		{% endfor %}
	</tbody>
</table>
{% if paginator|default() %}
	{{ admin_macro.ajax_paginator(paginator) }}
{% endif %}
